﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Water.Web.Controls.BaseInterface;
using System.ComponentModel;

namespace Water.Web.Controls
{
    public class ImageField : System.Web.UI.WebControls.ImageField, IDataControlFieldPrompt
    {
        #region private fields

        private string headerPrpmpt;

        private string footerPrompt;

        #endregion

        #region IDataControlFieldPrompt 成员

        [Browsable(true), GlobalizeCategory("PROMPT"), GlobalizeDescription("HeaderPrpmpt")]
        public virtual string HeaderPrompt
        {
            get { return headerPrpmpt; }
            set { headerPrpmpt = value; }
        }

        [Browsable(true), GlobalizeCategory("PROMPT"), GlobalizeDescription("FooterPrompt")]
        public virtual string FooterPrompt
        {
            get { return footerPrompt; }
            set { footerPrompt = value; }
        }


        #endregion

        #region override

        public override string HeaderText
        {
            get
            {
                if (string.IsNullOrEmpty(base.HeaderText) && !string.IsNullOrEmpty(HeaderPrompt))
                    base.HeaderText = Water.Web.Prompt.PromptProxy.GetPromptDesc(HeaderPrompt);
                return base.HeaderText;
            }
            set
            {
                base.HeaderText = value;
            }
        }

        public override string FooterText
        {
            get
            {
                if (string.IsNullOrEmpty(base.FooterText) && !string.IsNullOrEmpty(FooterPrompt))
                    base.FooterText = Water.Web.Prompt.PromptProxy.GetPromptDesc(FooterPrompt);
                return base.FooterText;
            }
            set
            {
                base.FooterText = value;
            }
        }

        #endregion
    }
}
